package com.memory.api.controller.inner;

import com.memory.api.service.UserInterfaceInfoService;
import com.memory.client.feignClient.UserInterfaceInfoFeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 该服务仅内部调用，不是给前端的
 */
@RestController
@RequestMapping("/user/interface/inner")
public class UserInterfaceInnerController implements UserInterfaceInfoFeignClient {

    @Resource
    private UserInterfaceInfoService userInterfaceInfoService;

    /**
     * 接口调用统计
     *
     * @param interfaceInfoId 接口 id
     * @param userId          用户 id
     * @return 是否调用成功
     */
    @Override
    @GetMapping("/get/invoke/count")
    public boolean invokeCount(long interfaceInfoId, long userId) {
        return userInterfaceInfoService.invokeCount(interfaceInfoId, userId);
    }
}